package org.syncsoft.overalt.domain.document.joson;

import org.syncsoft.overalt.common.json.AbstractJsonConverter;
import org.syncsoft.overalt.common.json.JSonTree;
import org.syncsoft.overalt.domain.document.entity.Permission;

/**
 * 
 * @author tptfc
 *
 */
public class PermissionJsonConverter extends AbstractJsonConverter<Permission> {

	@Override
	protected Permission converter(JSonTree jsonTree) {
		Permission permission = Permission.PUBLIC;
		String isPrivate = jsonTree.getParameterValue("isPrivate");
		
		if ("false".equals(isPrivate)) {
			permission = Permission.PRIVATE;
		}
		
		return permission;
	}

}
